'use strict';
angular.module('app.auth').controller('RegistCtrl', function ($scope, $location, postService, userHttpS,personalCenterHttp) {
    $scope.credentials = {
        username:'',
        email: '',
        password: '',
        passwordConfirm:''
    };
    $scope.warning = '';
    $scope.regist_data = {};
    $scope.registPost = function () {   

        personalCenterHttp.register_user('register_user', $scope.regist_data).then(function (response) {
            if (response > 1) {
                window.location.href = appConfig.base[0].baseURI + "#/admin";
            }
            else {

                alert("注册失败");
            }
            
            
        })

       
        // 跳转到登陆界面

        // postService.postMessages($scope.regist_data).then(function(data){
        //        // console.log(data);
        //        if (data.data.status == "200") {
        //             window.location.href = baseurls + "admin#/firsthtml";
        //             var datasocket = { info_func: "登录", info_name: $scope.credentials.email, name: "success" };
        //             myAppGlobal.websockets.sensorSocket.emit('data_logfile_insert', datasocket);
        //             console.log(datasocket);
        //             actions.getUserAction();
        //        } else {
        //             var datasocket = { info_func: "登录", info_name: $scope.credentials.email, name: "fail" };
        //             myAppGlobal.websockets.sensorSocket.emit('data_logfile_insert', datasocket);
        //             console.log(datasocket);
        //             $scope.warning="邮件或者密码错误！"; 
        //        }

        //  });

    }





})